package com.ruoyi.count.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.count.domain.StudentStatistics;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.count.domain.Studentstandardscores;
import com.ruoyi.count.service.IStudentstandardscoresService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * studentstandardscoresController
 * 存储进行计算之后的Z分和标准分
 * @author yxy
 * @date 2024-10-24
 */
@RestController
@RequestMapping("/studentstandardscores/studentstandardscores")
public class StudentstandardscoresController extends BaseController
{
    @Autowired
    private IStudentstandardscoresService studentstandardscoresService;

    /**
     * 查询studentstandardscores列表
     */
    @Anonymous
    @GetMapping("/list")
    public List<Studentstandardscores> list(Studentstandardscores studentstandardscores)
    {
//        startPage();
        List<Studentstandardscores> list = studentstandardscoresService.selectStudentstandardscoresList(studentstandardscores);
        return list;
    }

    /**
     * 导出studentstandardscores列表
     */
    @PreAuthorize("@ss.hasPermi('studentstandardscores:studentstandardscores:export')")
    @Log(title = "studentstandardscores", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Studentstandardscores studentstandardscores)
    {
        List<Studentstandardscores> list = studentstandardscoresService.selectStudentstandardscoresList(studentstandardscores);
        ExcelUtil<Studentstandardscores> util = new ExcelUtil<Studentstandardscores>(Studentstandardscores.class);
        util.exportExcel(response, list, "studentstandardscores数据");
    }

    /**
     * 获取studentstandardscores详细信息
     */
    @PreAuthorize("@ss.hasPermi('studentstandardscores:studentstandardscores:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(studentstandardscoresService.selectStudentstandardscoresById(id));
    }

    /**
     * 新增studentstandardscores
     */
    @PreAuthorize("@ss.hasPermi('studentstandardscores:studentstandardscores:add')")
    @Log(title = "studentstandardscores", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Studentstandardscores studentstandardscores)
    {
        return toAjax(studentstandardscoresService.insertStudentstandardscores(studentstandardscores));
    }

    /**
     * 修改studentstandardscores
     */
    @PreAuthorize("@ss.hasPermi('studentstandardscores:studentstandardscores:edit')")
    @Log(title = "studentstandardscores", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Studentstandardscores studentstandardscores)
    {
        return toAjax(studentstandardscoresService.updateStudentstandardscores(studentstandardscores));
    }

    /**
     * 删除studentstandardscores
     */
    @PreAuthorize("@ss.hasPermi('studentstandardscores:studentstandardscores:remove')")
    @Log(title = "studentstandardscores", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(studentstandardscoresService.deleteStudentstandardscoresByIds(ids));
    }

    /**
     * 查询特定学生的全部月份的成绩
     */
    @Anonymous
    @GetMapping(value = "/list/{Studentid}")
    public AjaxResult list(@PathVariable("Studentid") String Studentid)
    {
        return success(studentstandardscoresService.selectStudentstandardscoresListbyStudentid(Studentid));
    }
}
